home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / net / if_arp.h < prev    next >
C/C++ Source or Header  |  1990-11-29  |  3KB  |  72 lines

  1. /*
  2.  * Copyright (c) 1986 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  *
  12.  *    @(#)if_arp.h    7.2 (Berkeley) 12/30/87
  13.  * $Header: /sprite/src/lib/include/net/RCS/if_arp.h,v 1.5 90/11/29 19:39:48 kupfer Exp $
  14.  */
  15.  
  16. #ifndef _IF_ARP
  17. #define _IF_ARP
  18.  
  19. #include <sys/socket.h>
  20.  
  21. /*
  22.  * Address Resolution Protocol.
  23.  *
  24.  * See RFC 826 for protocol description.  ARP packets are variable
  25.  * in size; the arphdr structure defines the fixed-length portion.
  26.  * Protocol type values are the same as those for 10 Mb/s Ethernet.
  27.  * It is followed by the variable-sized fields ar_sha, arp_spa,
  28.  * arp_tha and arp_tpa in that order, according to the lengths
  29.  * specified.  Field names used correspond to RFC 826.
  30.  */
  31. struct    arphdr {
  32.     u_short    ar_hrd;        /* format of hardware address */
  33. #define ARPHRD_ETHER     1    /* ethernet hardware address */
  34.     u_short    ar_pro;        /* format of protocol address */
  35.     u_char    ar_hln;        /* length of hardware address */
  36.     u_char    ar_pln;        /* length of protocol address */
  37.     u_short    ar_op;        /* one of: */
  38. #define    ARPOP_REQUEST    1    /* request to resolve address */
  39. #define    ARPOP_REPLY    2    /* response to previous request */
  40. #define REVARP_REQUEST    3    /* request for reverse ARP */
  41. #define REVARP_REPLY    4    /* response to RARP request */
  42. /*
  43.  * The remaining fields are variable in size, according to the
  44.  * sizes above, and are defined on a network-by-network basis.
  45.  * For example, see <netinet/if_ether.h> for Ethernet-to-and-from-IP
  46.  * translation.
  47.  */
  48. #if 0
  49.     u_char    ar_sha[];    /* sender hardware address */
  50.     u_char    ar_spa[];    /* sender protocol address */
  51.     u_char    ar_tha[];    /* target hardware address */
  52.     u_char    ar_tpa[];    /* target protocol address */
  53. #endif
  54. };
  55.  
  56. /*
  57.  * ARP ioctl request
  58.  */
  59. struct arpreq {
  60.     struct    sockaddr arp_pa;        /* protocol address */
  61.     struct    sockaddr arp_ha;        /* hardware address */
  62.     int    arp_flags;            /* flags */
  63. };
  64. /*  arp_flags and at_flags field values */
  65. #define    ATF_INUSE    0x01    /* entry in use */
  66. #define ATF_COM        0x02    /* completed entry (enaddr valid) */
  67. #define    ATF_PERM    0x04    /* permanent entry */
  68. #define    ATF_PUBL    0x08    /* publish entry (respond for other host) */
  69. #define    ATF_USETRAILERS    0x10    /* has requested trailers */
  70.  
  71. #endif _IF_ARP
  72.